package com.example.demo2.handel;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * @author zhw
 */
@Aspect
@Component
public class LogAspectHandler {

    private static final Logger log = LoggerFactory.getLogger(LogAspectHandler.class);

    @Pointcut("execution(* com.example.demo2.controller..*.*(..))")
    public void pointCut() {}

    @Before("pointCut()")
    public void doBefore(JoinPoint joinPoint) {
        log.info("开始做饭");
    }

    @After("pointCut()")
    public void doAfter(){
        log.info("开始洗锅");
    }

}
